{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1442
  Verdict: Accepted
}
uses SysUtils;
 
var
	i,j:longint;
	ans,ii,jj,k,n:int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
i:=1;
j:=1;
ii:=1;
jj:=1;
k:=0;
ans:=0;
while k<n do begin
	inc(k);
	if ii<=jj then begin
		ans:=ii;
		inc(i);
		ii:=int64(i)*int64(i);	
	end else begin
		ans:=jj;
		inc(j);
		jj:=int64(j)*int64(j)*int64(j);
	end;
	if trunc(sqrt(j))=sqrt(j) then begin
		inc(j);
		jj:=int64(j)*int64(j)*int64(j);
	end;
end; 
write(ans);
end.